履歴: 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 18 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2017/5/26 11:44:16 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる 最新版 | 6,321 | +2 | -3 | 表示 | 差分 | — |
| 2017/5/26 2:44:16 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 6,299 | +14 | -0 | 表示 | 表示中 | 選択 |
| 2017/5/25 14:01:01 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 5,701 | +143 | -0 | 表示 | 差分 | 選択 |
| 2017/5/25 12:52:34 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 2,894 | +17 | -6 | 表示 | 差分 | 選択 |
| 2017/3/1 3:06:41 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 2,522 | +5 | -0 | 表示 | 差分 | 選択 |
| 2017/3/1 3:06:41 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 2,480 | +1 | -1 | 表示 | 差分 | 選択 |
| 2017/2/27 15:22:04 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 2,460 | +14 | -387 | 表示 | 差分 | 選択 |
| 2017/2/26 15:32:54 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 21,268 | +48 | -1 | 表示 | 差分 | 選択 |
| 2017/2/25 22:53:22 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 19,336 | +41 | -21 | 表示 | 差分 | 選択 |
| 2017/2/25 2:53:28 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 18,832 | +331 | -1 | 表示 | 差分 | 選択 |
| 2017/2/24 11:11:28 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 1,822 | +28 | -7 | 表示 | 差分 | 選択 |
| 2017/2/15 6:25:29 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 1,369 | +2 | -568 | 表示 | 差分 | 選択 |
| 2017/2/14 18:47:02 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 25,777 | +43 | -1 | 表示 | 差分 | 基準 |
| 2017/2/14 16:32:47 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 23,227 | +314 | -9 | 表示 | 差分 | 選択 |
| 2017/2/14 8:26:39 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 9,392 | +208 | -3 | 表示 | 差分 | 選択 |
| 2017/2/13 16:41:48 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 1,824 | +34 | -2 | 表示 | 差分 | 選択 |
| 2017/2/13 12:36:35 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 926 | +31 | -2 | 表示 | 差分 | 選択 |
| 2017/2/13 9:19:30 | 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる | 338 | — | — | 表示 | — | 選択 |
基準: 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる (2017/2/14 18:47:02) → 比較: 電気回路/zynq/Linux に平行してベアメタルプログラムを走らせる (2017/5/26 2:44:16)
@@ -4,7 +4,7 @@
* CPU でリアルタイム処理をしたい [#p86d9575]
-UI や通信を Linux で行いつつ、~
+UI や通信に関する処理を Linux で行いつつ、~
リアルタイム性能の必要な処理を別途動かしたい。
Zynq には CPU が2つあるので、1つを Linux に、
@@ -17,8 +17,11 @@
だけでリアルタイム処理ができるのかもしれないけれど、
そういう話にはなっていないようで。
-* 資料 [#w2117929]
+** まだまだ道半ばです [#b66245bd]
+結構大変・・・
+** 資料 [#w2117929]
+
シンプルな AMP : 2 つの Zynq SoC プロセッサ上で動作する Linux およびベアメタルシステム~
https://japan.xilinx.com/support/documentation/application_notes/j_xapp1078-amp-linux-bare-metal.pdf
@@ -37,593 +40,242 @@
これを読めばいいのかも。
-* 概要 [#ya93739b]
+** OpenAmp を使えるとよさそう [#ya93739b]
-** OpenAMP [#s36acb3e]
-
https://github.com/OpenAMP/open-amp
+Xilinx の OpenAmp というしくみを使うと、
CPU0 で走る Linux アプリから FreeRTOS や ベアメタル アプリを CPU1 で立ち上げたり、
そのリモートアプリとの間で通信をしたり、リモートアプリに Linux の資源を使わせたり
-するためのライブラリとのことで、まさに欲しかった機能と言えます。
+できるとのことで、まさに欲しかった機能と言えます。
-- remoteproc ホストからリモートのプロセスを制御する
-- RPMsg ホストとリモートとの間での通信手段を提供する
+- OpenAmp の機能
+-- remoteproc ホストからリモートのプロセスを制御する
+-- RPMsg ホストとリモートとの間での通信手段を提供する
-OpenAMP は petalinux と、libmetal ライブラリの上に成り立っています。
+OpenAmp は petalinux を前提としていて、libmetal に依存しているのだそうです。
-** libmetal [#nc69c479]
-linux, freertos, baremetal で共通に使えるライブラリ API を提供し、
-デバイスへのアクセスや割り込み制御、メモリ確保、その他ユーティリティ機能を提供するもの
-のようです。
+* petalinux [#ma53223d]
-** Petalinux [#rdedf389]
+Xilinx がメンテナンスしている Linux ディストリビューション。
-*** 概要 [#y122c6a2]
+開発環境、ブートローダ、カーネル、ソフトウェアパッケージ、すべてがこれでまかなえる。
-オープンソースの Xilinx Linux とは別物。Xilinx が開発している。
+ただし設定、コンパイル、デプロイにものすごく時間がかかるので、
+そのままの形で開発に使うには向かないのかも。
-登録は必要だが無料で使える。
+- [[電気回路/zynq/Petalinux のビルド]]~
+とりあえず標準の形で起動可能な SD カードを作成するところまで~
+~
+- [[電気回路/zynq/Petalinux のカスタマイズ]]~
+いろいろカスタマイズして開発環境を整えた内容
-*** ダウンロード [#w38e9003]
+上記で以下を実現できています。
-https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html
+- カーネルとして Linux 4.6.0-xilinx をカスタマイズして使える
+- Ubuntu 16.04 のパッケージングシステムを使える
+- /boot/uEnv.txt の書き換えで bootargs その他の起動方法を変更できる
+- /boot/system.bit.bin の書き換えでロジックを変更できる
+- /boot/devicetree.dtb の書き換えでデバイスを追加できる
+- [[電気回路/zynq/Device Tree Overlay]] の手順で、
+Linux を再起動せず device tree を書き換えられる
-ここから petalinux-v2016.4-final-installer1.run のようなファイルを落とす。
+* libmetal [#nc69c479]
-https://japan.xilinx.com/support/answers/68370.html
+https://github.com/OpenAMP/libmetal
-によれば カーネルバージョンは 4.6 だそうだ。
+linux, freertos, baremetal で共通に使えるライブラリ API を提供し、
+デバイスへのアクセスや割り込み制御、メモリ確保、その他ユーティリティ機能を提供するもの
+のようです。
-*** インストール [#q2587901]
+- Linux user space (based on UIO and VFIO support in the kernel)
+- RTOS (with and without virtual memory)
+- Bare-metal environments
-ここでは VirtualBox 内の Debian9 stretch に入れてみる
+となっているので、metal_xxx という共通の名前の関数ではあるものの、
+環境によって実装を変え、適切な API 呼び出しに変換してくれる、ということみたい。
-インストール方法は、~
-https://japan.xilinx.com/support/documentation-navigation/development-tools/software-development/petalinux-tools.html から
-ug1144-petalinux-tools-reference-guide.pdf にあります。
+** petalinux ではチェックボックス一つでインストール可能? [#x0e2da29]
-先に petalinux が要求するパッケージを入れます。
-diffstat xvfb chrpath xterm libtool は上記ガイドに書かれていませんが、
-インストール時に入れろと言われます。
+petalinux-config -c rootfs で選択できるので、 チェックするだけでインストールできルっぽい?
- LANG:console
- $ sudo apt-get install build-essential binutils ncurses-dev u-boot-tools file
- $ sudo apt-get install tofrodos iproute2 gawk net-tools libncurses5-dev tftp tftpd-hpa zlib1g-dev libssl-dev flex bison libselinux1
- $ sudo apt-get install diffstat xvfb chrpath xterm libtool
+ただこれでやるとユーザープロジェクトもすべて petalinux のビルドシステムを使わなければならなくなってややこしい。
-petalinux のインストーラは巨大なバイナリを含んだ bash スクリプトです。
-bash スクリプトなので実行権限が無くても bash に読ませれば実行できます。
+GitHub で公開されているソースから単独でインストールできないものか、
+と四苦八苦しているのがこちらです。~
+>> [[電気回路/zynq/libmetal のインストール]] ← あんまり意味が無いことが後から判明
-インストーラを root で走らせると途中で以下のエラーが出ます。
+** そうじゃなくて Xilinx SDK から使うべき [#u1313afb]
- ERROR: The extensible sdk cannot be installed as root.
- ERROR: Failed to install Yocto SDK for zynqMP.
+libmetal も openamp も、ビルドには手順に沿って board support package (BSP) を使わないと、
+必要なライブラリへのパスを通すのにも一苦労します。
-一方、インストーラを 非root で走らせると、/opt などのルート権限の
-必要なフォルダにはインストールできません。
+Petalinux の操作を全て覚えればできるのかもしれませんが、片手間でやるには
+Xilinx SDK の GUI から使わないととてもじゃないけど使いこなせない感じ。
-基本的に、ユーザーのホーム以下へのインストールが期待されているようです?~
-ここでは ~/z-turn/petalinux へインストールすることにしました。
+以降、そっちでやってみます。
-ところでこれ、元のインストールファイルが大きく、/tmp に展開される
-ファイルも大きくて、インストール後も大きいので、インストールファイル
-ダウンロード前の VirtualBox の空き容量が 30GB 弱だと途中でぎりぎり
-Disk Full になりました。35GB もあれば大丈夫そうですが、かなり
-待たされた後でエラーが出るので、余裕を持った方が精神的に楽です。
+* Xilinx SDK から OpenAMP を使う [#oa16b34b]
-インストール後は 15.9 GB でした。
+リポジトリは https://github.com/OpenAMP/open-amp にあるけれど、
+Xilinx SDK から使う分にはそのあたりを気にする必要はないようです。
- LANG:console
- $ bash petalinux-v2016.4-final-installer1.run -h
- PetaLinux installer.
-
- Usage:
- petalinux-v2016.4-final-installer1.run [--log <LOGFILE>] [INSTALL_DIR]
-
- Options:
- --log <LOGFILE> specify where the logfile should be created.
- it will be petalinux_installation_log
- in your working directory by default.
- [INSTALL_DIR] specify the directory where you want to
- install the tool kit. If not specified,
- it will install to your working directory.
-
- $ mkdir ~/z-turn/petalinux
- $ # インストールに sudo はしません
- $ bash petalinux-v2016.4-final-installer1.run ~/z-turn/petalinux
- INFO: Checking installer checksum...
- INFO: Extracting PetaLinux installer...
- INFO: Installing PetaLinux...
- INFO: Checking PetaLinux installer integrity...
- INFO: Extracting Installation files...
- # ここまで、ものすごく時間がかかります
- LICENSE AGREEMENTS
-
- PetaLinux SDK contains software from a number of sources. Please review
- the following licenses and indicate your acceptance of each to continue.
-
- You do not have to accept the licenses, however if you do not then you may
- not use PetaLinux SDK.
-
- Use PgUp/PgDn to navigate the license viewer, and press 'q' to close
-
- Press Enter to display the license agreements
- Do you accept Xilinx End User License Agreement? [y/N] > y
- Do you accept Webtalk Terms and Conditions? [y/N] > y
- Do you accept Third Party End User License Agreement? [y/N] > y
- INFO: Checking installation environment requirements...
- INFO: Checking free disk space
- INFO: Checking installed tools
- ERROR: You are missing the following system tools required by PetaLinux:
-
- - libtool
- Please check PetaLinux installation guide - required tools and libraries
- pacakge section for detailed information
-
- INFO: Checking installed development libraries
- Please install them with your operating system package manager, and try again
- INFO: Checking network and other services
- INFO: Installing PetaLinux SDK to "/home/osamu/z-turn/petalinux/."
- INFO: Installing PetaLinux zynqMP Yocto SDK to "/home/osamu/z-turn/petalinux/./components/yocto/source/aarch64"...
- PetaLinux Extensible SDK installer version 2016.4
- =================================================
- You are about to install the SDK to "/home/osamu/z-turn/petalinux/components/yocto/source/aarch64".
- Proceed[Y/n]? Y
- Extracting SDK...............................done
- Setting it up...
- Extracting buildtools...
- done
- SDK has been successfully set up and is ready to be used.
- Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
- $ . /home/osamu/z-turn/petalinux/components/yocto/source/microblaze_lite/environment-setup-microblazeel-v10.0-bs-cmp-ml-xilinx-linux
- INFO: PetaLinux Yocto SDK for microblaze has been successfully installed.
- INFO: PetaLinux SDK has been installed to /home/osamu/z-turn/petalinux/.
+これに沿ってやってみるのが良さそう~
+https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_2/ug1186-zynq-openamp-gsg.pdf
-libtool はすでに入っているのだけれど・・・とりあえず無視して続行します。
+* echo-test [#g669def7]
-*** 動作環境の構築 [#v45a3c2e]
+CPU-0 で実行中の Linux から、~
+CPU-1 用に standalone 実行ファイルを読み込んで走らせる。
-libtoolize を libtool として起動できるようにする
+CPU-0 側から送った文字列を CPU-1 側から返して画面に表示する。
- LANG:console
- $ source ~/z-turn/petalinux/settings.sh
- PetaLinux environment set to '/home/osamu/z-turn/petalinux'
- WARNING: /bin/sh is not bash!
- bash is PetaLinux recommended shell. Please set your default shell to bash.
- INFO: Checking free disk space
- INFO: Checking installed tools
- ERROR: You are missing the following system tools required by PetaLinux:
-
- - libtool
- Please check PetaLinux installation guide - required tools and libraries
- pacakge section for detailed information
-
- INFO: Checking installed development libraries
- Please install them with your operating system package manager, and try again
- INFO: Checking network and other services
- WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide"
- for its impact and solution
- $ sudo apt-get install libtool
- libtool はすでに最新バージョン (2.4.6-2) です。
- アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 336 個。
- $ libtool
- -bash: libtool: コマンドが見つかりません
- $ libtoolize --version
- libtoolize (GNU libtool) 2.4.6
- Written by Gary V. Vaughan <gary@gnu.org>, 2003
-
- Copyright (C) 2015 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- $ apt-get install libtool-bin
- $ libtool
- -bash: libtool: コマンドが見つかりません
- $ # 別名を付けるだけでいいという噂も?
- $ sudo ln -s /usr/bin/libtoolize /usr/local/bin/libtool
- $ source z-turn/petalinux/settings.sh
- PetaLinux environment set to '/home/osamu/z-turn/petalinux'
- WARNING: /bin/sh is not bash!
- bash is PetaLinux recommended shell. Please set your default shell to bash.
- INFO: Checking free disk space
- INFO: Checking installed tools
- INFO: Checking installed development libraries
- INFO: Checking network and other services
- WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide"
- for its impact and solution
- $ echo $PETALINUX
- /home/osamu/z-turn/petalinux
- $ arm-linux-gnueabihf-gcc --version
- arm-linux-gnueabihf-gcc (Linaro GCC 5.2-2015.11-2) 5.2.1 20151005
- Copyright (C) 2015 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- $ arm-none-eabi-gcc --version
- arm-none-eabi-gcc (Linaro GCC 5.2-2015.11-2) 5.2.1 20151005
- Copyright (C) 2015 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- $
+** standalone 側の準備 [#zf9f46f7]
-パッケージ使用状況のサーベイを off にする
- LANG:console
- $ z-turn/petalinux/tools/common/petalinux/bin/petalinux-util --webtalk off
- INFO: Turn off webtalk feature!
+*** プロジェクトの作成 [#r90bcae7]
-*** 新しいプロジェクトを作る [#aabc4100]
+[File]-[New]-[New Project...]~
+&ref(new_project_stdalone.png,,66%);
-z-turn ボード用にビルドしたいのだけれど、公式にはサポートされていないので、
-試しに zedboard 用のテンプレートを落としてみた。
+- Project name: echo_stdalone
+- OS Platform: standalone
+- Processor: ps7_cortex9_1
+- Language: C (C++ を選ぶと目的のテンプレートが表示されない)
+- BSP: Create new
- LANG:console
- $ file avnet-digilent-zedboard-v2016.4-final1.bsp
- avnet-digilent-zedboard-v2016.4-final1.bsp: gzip compressed data, last modified: Fri Dec 16 03:02:22 2016, from Unix
- $ tar fxz avnet-digilent-zedboard-v2016.4-final1.bsp
- $ cd avnet-digilent-zedboard-2016.4/
- $ ls
- components config.project hardware pre-built project-spec
+で [Next]
-かなりいろいろ入ってる。。。
+&ref(new_project_stdalong2.png,,66%);
-これを元にプロジェクトを作るのというのがチュートリアルだけれど、
-ここではそんな便利なものはないので、zynq 用の汎用テンプレートを使って作る。
+- Available Template: OpenAMP echo test
- LANG:console
- $ cd ~/z-turn
- $ petalinux-create -t project --template zynq -n zturn-v2016.4
- INFO: Create project: zturn-v2016.4
- INFO: New project successfully created in /home/osamu/z-turn/zturn-v2016.4
- $ cd zturn-v2016.4
- $ git init
- Initialized empty Git repository in /home/osamu/z-turn/zturn-v2016.4/.git/
- $ cat <<EOT > .gitignore
- .petalinux
- build
- images
- EOT
- $ git add .
- $ git commit -m "newly created"
- $ ls project-spec/
- attributes configs hw-description meta-user
+で [Finish]
-どうやら project-spec/ というのが petalinux のプロジェクト本体のようだ。
+&ref(new_project_stdalone3.png,,66%);
-*** vivado のハードウェア設定を出力する [#a82e50cc]
+プロジェクトができた。
-z-turn についていた mys-xc7z020-trd.xpr から [File]-[Export]-[Export Hardware...]
+*** echo_stdalone_bsp を Build する [#u301257c]
-&ref(file-export-hardware.png,,66%);
+まずはいくつか設定
-[Include bitstream], [Local to Project] で OK
+&ref(set_compiler_flag_for_bsp.png,,50%);
-&ref(export-including-bitstream.png,,66%);
+bsp プロジェクトを右クリックから [Board Support Package Settings]
-この操作により、
+&ref(DUNDEFINE_FILE_OPS.png,,50%);
-(project dir)/(project-name).sdk/design_1_wrapper_hw_platform_0/*
+[Overview]-[drivers]-[ps7_cortexa9_1] を選んで [extra_compiler_flags] を確認すると、
+_open(), _close(), _read(), _write() をマスター側にリダイレクトするためのオプション
-に design_1_wrapper.bit, ps7_init.* や system.hdf が出力されます。
+- -DUNDEFINE_FILE_OPS
-&ref(exported-hardware-configuration.png,,66%);
+はすでに登録されていた。
-*** vivado のハードウェア設定を取り込みつつ基本の設定 [#y20ed9c0]
+vector table を OCM に置くのが一般的なようで、
-上記フォルダ(コピーしたもの)を指定して petalinux-config すると、
-ハードウェア設定を取り込んだ後、いろいろ設定可能なメニューが現れます。
+- -DVEC_TABLE_IN_OCM
- LANG:console
- $ cd (petalinux-project-dir)
- $ petalinux-config --get-hw-description=../design_1_wrapper_hw_platform_1
- INFO: Getting hardware description...
- [INFO] generating Kconfig for project
- ...
+も指定しておくと良いみたい。
-&ref(petalinux-system-configuration.png,,66%);
+リソースの初期化をマスター側で行う場合に必要な
-とりあえず何も変更せずに Exit して設定を保存。
+- -DUSE_AMP=1
- LANG:console
- [INFO] menuconfig project
- /home/osamu/z-turn/zturn-v2016.4/build/misc/config/Kconfig.syshw:30:warning: defaults for cho
- /home/osamu/z-turn/zturn-v2016.4/build/misc/config/Kconfig:546:warning: config symbol defined
- configuration written to /home/osamu/z-turn/zturn-v2016.4/project-spec/configs/config
-
- *** End of the configuration.
- *** Execute 'make' to start the build or try 'make help'.
-
- [INFO] sourcing bitbake
- [INFO] generating plnxtool conf
- [INFO] generating meta-plnx-generated layer
- ~/z-turn/zturn-v2016.4/build/misc/plnx-generated ~/z-turn/zturn-v2016.4
- ~/z-turn/zturn-v2016.4
- [INFO] generating machine configuration
- [INFO] generating bbappends for project . This may take time !
- ~/z-turn/zturn-v2016.4/build/misc/plnx-generated ~/z-turn/zturn-v2016.4
- # ここでものすごく時間がかかります
- ~/z-turn/zturn-v2016.4
- [INFO] generating u-boot configuration files
-
- [INFO] generating kernel configuration files
- [INFO] generating kconfig for Rootfs
- WARNING: Host distribution "Debian-9.0" has not been validated with this version of the
- build system; you may possibly experience unexpected failures. It is recommended that you
- use a tested distribution.
- Loading cache: 100% |########################################################| ETA: 00:00:00
- Loaded 2937 entries from dependency cache.
- Parsing recipes: 100% |######################################################| Time: 00:00:05
- Parsing of 2325 .bb files complete (2285 cached, 40 parsed). 2940 targets, 196 skipped, 0 masked, 0 errors.
- NOTE: Resolving any missing task queue dependencies
- NOTE: Preparing RunQueue
- NOTE: PN build list saved to 'pn-buildlist'
- NOTE: PN dependencies saved to 'pn-depends.dot'
- NOTE: Package dependencies saved to 'package-depends.dot'
- NOTE: Task dependencies saved to 'task-depends.dot'
-
- Summary: There was 1 WARNING message shown.
- Generate rootfs kconfig
- [INFO] oldconfig rootfs
- [INFO] generating petalinux-user-image.bb
- $
+も指定しておく。
-Debian はサポートしないと言われたけれど、続行してみます。
+&ref(bsp-compiler-options.png,,50%);
-*** カーネルをビルドしてみる [#q69e8291]
+[Ok] して bsp プロジェクトを build した。
LANG:console
- $ petalinux-build
- [INFO] building project
- [INFO] sourcing bitbake
- INFO: bitbake petalinux-user-image
- WARNING: Host distribution "Debian-9.0" has not been validated with this version of the build
- system; you may possibly experience unexpected failures. It is recommended that you use a
- tested distribution.
- Loading cache: 100% |########################################################| ETA: 00:00:00
- Loaded 2938 entries from dependency cache.
- Parsing recipes: 100% |######################################################| Time: 00:00:05
- Parsing of 2325 .bb files complete (2291 cached, 34 parsed). 2940 targets, 196 skipped, 0 masked, 0 errors.
- NOTE: Resolving any missing task queue dependencies
- NOTE: Preparing RunQueue
- NOTE: Checking sstate mirror object availability (for 597 objects)
- NOTE: Executing SetScene Tasks
- NOTE: Executing RunQueue Tasks
- No currently running tasks (803 of 1810)
- No real function for mknod: /home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/bin/../lib/pseudo/lib64/libpseudo.so: undefined symbol: mknod
- No real function for mknodat: /home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/bin/../lib/pseudo/lib64/libpseudo.so: undefined symbol: mknodat
- ...
- WARNING: petalinux-user-image-1.0-r0 do_rootfs: No not found in the base feeds (plnx_arm
- cortexa9t2hf-neon cortexa9t2hf-vfp cortexa9hf-neon cortexa9hf-vfp armv7at2hf-neon armv7ahf-neon
- armv7at2hf-vfp armv7ahf-vfp armv6thf-vfp armv6hf-vfp armv5tehf-vfp armv5ehf-vfp armv5thf-vfp
- armv5hf-vfp noarch any all).
-
- WARNING: petalinux-user-image-1.0-r0 do_rootfs: real not found in the base feeds (plnx_arm
- cortexa9t2hf-neon cortexa9t2hf-vfp cortexa9hf-neon cortexa9hf-vfp armv7at2hf-neon armv7ahf-neon
- armv7at2hf-vfp armv7ahf-vfp armv6thf-vfp armv6hf-vfp armv5tehf-vfp armv5ehf-vfp armv5thf-vfp
- armv5hf-vfp noarch any all).
- ...
- ERROR: petalinux-user-image-1.0-r0 do_rootfs: Unable to install packages. Command
- '/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/bin/smart --log-level=warning
- --data-dir=/home/osamu/z-turn/zturn-v2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/petalinux-
- user-image/1.0-r0/rootfs/var/lib/smart install --attempt -y ' returned 1:
-
- No real function for mknod: /home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr
- /bin/../lib/pseudo/lib64/libpseudo.so: undefined symbol: mknod
- ...
-
- ERROR: petalinux-user-image-1.0-r0 do_rootfs: Function failed: do_rootfs
- ERROR: Logfile of failure stored in: /home/osamu/z-turn/zturn-v2016.4/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/petalinux-user-image/1.0-r0/temp/log.do_rootfs.17314
- ERROR: Task 9 (/home/osamu/z-turn/zturn-v2016.4/project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb, do_rootfs) failed with exit code '1'
- NOTE: Tasks Summary: Attempted 1690 tasks of which 1326 didn't need to be rerun and 1 failed.
- No currently running tasks (1690 of 1810)
-
- Summary: 1 task failed:
- /home/osamu/z-turn/zturn-v2016.4/project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb, do_rootfs
- Summary: There were 19 WARNING messages shown.
- Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
- ERROR: Failed to build project
- $ apt show libc6
- Package: libc6
- Version: 2.24-9
- ...
+ xscugic.c:248:2: warning: #warning "Building GIC for AMP" [-Wcpp]
+ #warning "Building GIC for AMP"
+ ^
+ xscugic_hw.c: In function 'DistInit':
+ xscugic_hw.c:118:3: warning: #warning "Building GIC for AMP" [-Wcpp]
+ #warning "Building GIC for AMP"
+ ^
+なんか warning 出た。
-No real function for mknod について:~
-https://forums.xilinx.com/t5/Embedded-Linux/Strange-messages-about-shared-libraries-in-Petalinux/td-p/729766 ~
-libc6 2.24 固有の問題で出るエラーで、メッセージは無視して良いと書いてある
+GIC は Generic Interrupt Controller だけど、
+このライブラリを bsp から外した方が良いということかしら???
-確かに、インストールされているのはバージョン 2.24 だ。。。
+ソースファイルを見ると、
-petalinux が推奨する Ubuntu 16.04 では libc6 は 2.23 になっている。
-たぶん、Ubuntu が 2.24 はやばいと思ってまだ上げていないんだと思う。
+xscugic.c
+ LANG:c
+ static void DistributorInit(XScuGic *InstancePtr, u32 CpuID)
+ {
+ u32 Int_Id;
+ u32 LocalCpuID = CpuID;
+ u32 RegValue;
+
+ #if USE_AMP==1 && (defined (ARMA9) || defined(__aarch64__))
+ #warning "Building GIC for AMP"
+ /*
+ * GIC initialization is taken care by master CPU in
+ * openamp configuration, so do nothing and return.
+ */
+ return;
+ #endif
+
+ RegValue = XScuGic_DistReadReg(InstancePtr, XSCUGIC_DIST_EN_OFFSET);
+ if (!(RegValue & XSCUGIC_EN_INT_MASK)) {
+ ...
- $ cd ~/z-turn/petalinux
- $ find | grep pseudo-1
- ./components/yocto/downloads/pseudo-1.7.5.tar.bz2
- $ cd components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo
- $ ls
- files/ pseudo.inc pseudo_1.6.7.bb pseudo_1.7.5.bb pseudo_git.bb
- $ ls files/
- 0001-configure-Prune-PIE-flags.patch fallback-group fallback-passwd handle-remove-xattr.patch
- moreretries.patch
+xscugic_hw.c
+ LANG:c
+ static void DistInit(XScuGic_Config *Config, u32 CpuID)
+ {
+ u32 Int_Id;
+ u32 LocalCpuID = CpuID;
+
+ #if USE_AMP==1
+ #warning "Building GIC for AMP"
+
+ /*
+ * The distrubutor should not be initialized by FreeRTOS in the case of
+ * AMP -- it is assumed that Linux is the master of this device in that
+ * case.
+ */
+ return;
+ #endif
+
+ XScuGic_WriteReg(Config->DistBaseAddress, XSCUGIC_DIST_EN_OFFSET, 0U);
+ ...
-えーと、上記リンクで紹介されているパッチを当てる先が見つからない?
+となっていて、むやみに初期化してしまわないようにしている。
-https://vendor2.nginfotpdx.net/gitlab/ypp/poky/commit/9df3cdf42d8c1216682f497f0b166a43ef9f4184 ~
-もあるけど、どうも見方がよくわからない。
+たぶん無視していいっぽい。
- LANG:console
- $ cd ~/z-turn/petalinux/components/yocto
- $ find . -type f -exec grep -l "No real function for" {} \;
- ./source/microblaze_lite/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/pseudo/lib64/libpseudo.so
- ./source/aarch64/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/pseudo/lib64/libpseudo.so
- ./source/microblaze_full/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/pseudo/lib64/libpseudo.so
- ./source/arm/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/pseudo/lib64/libpseudo.so
- $ cd ~/z-turn/petalinux
- $ find | grep pseudo-1
- ./components/yocto/downloads/pseudo-1.7.5.tar.bz2
- $ cd
- $ cd pseudo-1.7.5/
- $ grep -ls "No real function for" *
- pseudo_wrappers.c
- $ cat pseudo_wrappers.c
- ...
- #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
- char *s = func->name;
- s += strlen(s) - 2;
- /* *at() don't have to exist */
- if (!strcmp(s, "at")) {
- return;
- }
- #else
- if (e != NULL) {
- pseudo_diag("No real function for %s: %s\n", func->name, e);
- }
- #endif
- ...
- $ cd ..
+&ref(new_project_stdalone4.png,,50%);
-ここを潰せばいいのは、わかる。
+include の下に大量の .h ファイルができた
-雰囲気的には meta にパッチを置いておくと、.tar.bz2 を展開し、
-そのパッチを当ててからコンパイルしてくれる感じ?
+*** echo_stdalone を Build [#xe4426f6]
- LANG:c
- $ jed ~/z-turn/petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo/files/pseudo-glibc-rtld-next-workaround.patch
- We started seeing:
-
- No real function for mknod: /home/paul/poky_sdk/tmp/sysroots/x86_64-
- linux/usr/bin/../lib/pseudo/lib64/libpseudo.so: undefined symbol: mknod
- No real function for mknodat: /home/paul/poky_sdk/tmp/sysroots/x86_64-
- linux/usr/bin/../lib/pseudo/lib64/libpseudo.so: undefined symbol: mknodat
- ...
- Index: pseudo-1.7.5/pseudo_wrappers.c
- ===================================================================
- --- pseudo-1.7.5.orig/pseudo_wrappers.c
- +++ pseudo-1.7.5/pseudo_wrappers.c
- @@ -146,9 +146,9 @@ pseudo_init_one_wrapper(pseudo_function
- return;
- }
- #else
- - if (e != NULL) {
- + /*if (e != NULL) {
- pseudo_diag("No real function for %s: %s\n", func->name, e);
- - }
- + }*/
- #endif
- }
- }
- $ jed ~/z-turn/petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb
- ...
- file://pseudo-glibc-rtld-next-workaround.patch \
- ...
- $ rm -r build/tmp/work/x86_64-linux/pseudo-native/
- $ petalinux-build
- ...
- | gcc -isystem/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/include \
- | -O2 -pipe -pipe -std=gnu99 -Wall -W -Wextra -fPIC -D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE \
- | -isystem/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe \
- | -DPSEUDO_PREFIX='"/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr"' \
- | -DPSEUDO_SUFFIX='""' -DPSEUDO_BINDIR='"bin"' -DPSEUDO_LIBDIR='"lib/pseudo/lib64"' \
- | -DPSEUDO_LOCALSTATEDIR='"var/pseudo"' -DPSEUDO_VERSION='"1.7.5"' -DUSE_MEMORY_DB \
- | -DPSEUDO_FORCE_ASYNC -DPSEUDO_PASSWD_FALLBACK='NULL' -DPSEUDO_XATTR_SUPPORT \
- | -O2 -g -L/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/lib \
- | -I/home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/include -o bin/pseudo \
- | pseudo.o pseudo_server.o pseudo_client.o pseudo_ipc.o pseudo_db.o pseudo_tables.o pseudo_util.o \
- | /home/osamu/z-turn/zturn-v2016.4/build/tmp/sysroots/x86_64-linux/usr/lib/libsqlite3.a -lpthread \
- | -ldl -lpthread
- | /usr/bin/ld: final link failed: Nonrepresentable section on output
- | collect2: error: ld returned 1 exit status
- | Makefile:110: recipe for target 'bin/pseudo' failed
- | make: *** [bin/pseudo] Error 1
- | WARNING: exit code 1 from a shell command.
- | ERROR: oe_runmake failed
- | ERROR: Function failed: do_compile (log file is located at /home/osamu/z-turn/zturn-v2016.4/build/tmp/work/x86_64-linux/pseudo-native/1.7.5-r0/temp/log.do_compile.25335)
- ERROR: Task 44 (virtual:native:/home/osamu/z-turn/petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb, do_compile) failed with exit code '1'
- NOTE: Tasks Summary: Attempted 126 tasks of which 120 didn't need to be rerun and 1 failed.
- Waiting for 0 running tasks to finish:
-
- Summary: 1 task failed:
- virtual:native:/home/osamu/z-turn/petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo/pseudo_1.7.5.bb, do_compile
- Summary: There was 1 WARNING message shown.
- Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
- ERROR: Failed to build kernel
- $ cd build/tmp/work/x86_64-linux/pseudo-native/1.7.5-r0/pseudo-1.7.5
- $ grep -s mknod\( *
- pseudo_wrapfuncs.c:__xmknod(int ver, const char *path, mode_t mode, dev_t *dev) {
- pseudo_wrapfuncs.c: rc = wrap___xmknod(ver, path, mode, dev);
- pseudo_wrapfuncs.c:wrap___xmknod(int ver, const char *path, mode_t mode, dev_t *dev) {
- pseudo_wrapfuncs.c:mknod(const char *path, mode_t mode, dev_t dev) {
- pseudo_wrapfuncs.c: rc = wrap_mknod(path, mode, dev);
- pseudo_wrapfuncs.c:wrap_mknod(const char *path, mode_t mode, dev_t dev) {
- pseudo_wrapfuncs.h:/* int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev) */
- pseudo_wrapfuncs.h:static int wrap___xmknod(int ver, const char *path, mode_t mode, dev_t *dev);
- pseudo_wrapfuncs.h:/* int mknod(const char *path, mode_t mode, dev_t dev) */
- pseudo_wrapfuncs.h:static int wrap_mknod(const char *path, mode_t mode, dev_t dev);
- pseudo_wrapper_table.c: { /* int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev); */
- pseudo_wrapper_table.c: { /* int mknod(const char *path, mode_t mode, dev_t dev); */
- $
+Binaries の下に echo_stdalone.elf ができた
-のようにして https://patchwork.openembedded.org/patch/123001/
-の内容を入れたところ、、、今度は
-リンクで失敗している?
+&ref(build_echo_stdalone.png,,66%);
-むしろ、pseudo-1.7.5/ports/unix/wrapfuncs.in
-から mknod と mknodat をなくしちゃえばいいとか、
-ないのかな?
+** Linux 側の準備 [#n28cc2e7]
- $ cd ~/pseudo-1.7.5
- $ cp ports/unix/wrapfuncs.in ports/unix/wrapfuncs.in_orig
- $ jed ports/unix/wrapfuncs.in
- - int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- - int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- + #int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- + #int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- $ diff -u ports/unix/wrapfuncs.in_orig ports/unix/wrapfuncs.in
- ...
-
- $ jed ~/z-turn/petalinux/components/yocto/source/arm/layers/poky/meta/recipes-devtools/pseudo/files/pseudo-glibc-rtld-next-workaround.patch
- Does this work?
-
- Index: pseudo-1.7.5/ports/unix/wrapfuncs.in
- ===================================================================
- --- pseudo-1.7.5.orig/ports/unix/wrapfuncs.in
- +++ pseudo-1.7.5/ports/unix/wrapfuncs.in
- @@ -43,8 +43,8 @@
- int mkdirat(int dirfd, const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW */
- int mkfifo(const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW */
- int mkfifoat(int dirfd, const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW */
- -int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- -int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- +#int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- +#int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- int mkstemp(char *template); /* flags=AT_SYMLINK_NOFOLLOW */
- int rename(const char *oldpath, const char *newpath); /* flags=AT_SYMLINK_NOFOLLOW */
- int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath); /* flags=AT_SYMLINK_NOFOLLOW */
- $ petalinux-build -c kernel
- ...
- # やはりエラー
- $ less build/tmp/work/x86_64-linux/pseudo-native/1.7.5-r0/pseudo-1.7.5/ports/unix/wrapfuncs.in
- ...
- int mkfifo(const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW */
- int mkfifoat(int dirfd, const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW */
- #int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- #int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW */
- int mkstemp(char *template); /* flags=AT_SYMLINK_NOFOLLOW */
- int rename(const char *oldpath, const char *newpath); /* flags=AT_SYMLINK_NOFOLLOW */
- ...
- # 正しくパッチはあったっていた
- $
+上記の pdf では
-すなおに Ubuntu にしろってことは、ある。
+- PetaLinux 上でリモート側のアプリをビルドして、~
+できたファームウェアを /lib/firmware/<myfirmware> に入れる
+- petalinux-config でカーネルベースアドレスを 0x10000000 にする~
+ベアメタルアプリのブートサポートがアドレス 0 からになるため
+- u-boot Configuration で netboot offset を (0x11000000) にする
+- Enable loadable module support にチェックを付ける
+- Device Drivers ---> Generic Driver Options ---> Userspace firmware loading support にチェックを付ける
+- Device Drivers ---> Remoteproc drivers ---> Support ZYNQ remoteproc にチェックを付ける
+- Kernel Features ---> Memory split (...)---> 2G/2G user/kernel split を選択 (1G/3G でも可)
+- Kernel Features ---> High Memory Support にチェックを付ける
+- rootfs の
-** Linux ファイルシステムを準備 [#gf284759]
-ここでは VirtualBox 内の Debian9 stretch に arm のエミュレータを入れて実行してみる。
+(以下未稿)
-まず [[電気回路/z-turn/Linuxの設定]] の流れで Linux ルートファイルシステムを作る。
-カーネルが 4.6 なので jessie ではなく stretch を入れた。
-(stretch では less や、ifconfig のための net-tools を別途インストールする必要がありました。)
-
- LANG:console
- $ sudo chroot ~/z-turn/rootfs
-
-これで、qemu 上での root 権限での実行に切り替わります。